package demo01;

import javax.naming.NamingException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test03 {
    public static void main(String[] args) throws ParseException, NamingException {
        // way("1999-11-11 22:22:22");
        byte[] bytes1 = "00000000000000casdasdad11111111111111111111111111111111111111111111111111".getBytes();
        byte[] bytes2 = "2222111111".getBytes();
        System.out.println(bytes1);
        System.out.println(bytes2);
        bytes1 = "1111".getBytes();
        System.out.println(bytes1);
        bytes1 = "1111".getBytes();
        System.out.println(bytes1);
    }

    public static void way(String date) throws NamingException, ParseException {
        byte[] bytes = date.getBytes();  //可能对方调用时传递一个null

        if (date == null) {
            throw new NullPointerException("日期为空");
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date dateTime = sdf.parse(date);
        System.out.println(bytes);
/*        for (byte b : bytes) {
            System.out.println(b);
        }*/
        int[] arr = {11, 22, 33};
        if (arr.length > 3 || arr.length < 0) {
            throw new ArrayIndexOutOfBoundsException("数组越界");
        }
        System.out.println(bytes);
/*        if(true){
            throw new NamingException();
        }*/
    }
}
